package com.ergou.easylive.common.enums;

import lombok.Getter;

/**
 * 统一状态码枚举
 */
@Getter
public enum ResultCode {
    SUCCESS(200, "操作成功"),
    CREATED(201, "创建成功"),
    ACCEPTED(202, "请求已接受"),
    NO_CONTENT(204, "操作成功，无返回内容"),

    BAD_REQUEST(400, "参数错误或请求格式不正确"),
    UNAUTHORIZED(401, "未授权，请先登录"),
    FORBIDDEN(403, "权限不足，禁止访问"),
    NOT_FOUND(404, "资源不存在"),
    METHOD_NOT_ALLOWED(405, "请求方法不允许"),

    INTERNAL_SERVER_ERROR(500, "服务器内部错误"),
    SERVICE_UNAVAILABLE(503, "服务不可用"),

    // 业务相关状态码（可根据需要扩展）
    USER_NOT_EXIST(1001, "用户不存在"),
    LOGIN_FAILED(1002, "登录失败，用户名或密码错误"),
    TOKEN_EXPIRED(1003, "Token已过期"),
    DATA_EXISTS(1004, "数据已存在"),
    DATA_NOT_EXISTS(1005, "数据不存在");

    private final int code;
    private final String message;

    ResultCode(int code, String message) {
        this.code = code;
        this.message = message;
    }
}